
using System;
using System.Text;

using NHibernate;
using NHibernate.Cfg;
using NHibernate.Criterion;
using NHibernate.Exceptions;

using SpotifyGenNHibernate.EN.Spotify;
using SpotifyGenNHibernate.CAD.Spotify;

namespace SpotifyGenNHibernate.CEN.Spotify
{
    public partial class UsuarioCEN
    {
        public bool HacerLogin (String p_oid, String pass)
        {
            /*PROTECTED REGION ID(Spotify.UsuarioCEN_HacerLogin_precondition) START*/

            // Preconditions
            // if( !() )
            //              throw new ModelException("Method HacerLogin() preconditions are violated.");

            /*PROTECTED REGION END*/

            /*PROTECTED REGION ID(Spotify.UsuarioCEN_HacerLogin_body) ENABLED START*/

            // Body
            try
            {
                UsuarioEN usu;
                usu = _IUsuarioCAD.ReadOIDDefault(p_oid);
                if (usu.Contrasena == pass)
                {
                    return true;
                }
                else 
                {
                    return false;
                }
            }
            catch (Exception ex)
            {
                //throw ex;
            }
            return false;
            /*PROTECTED REGION END*/

            /*PROTECTED REGION ID(Spotify.UsuarioCEN_HacerLogin_postcondition) START*/

            // Postconditions
            // if( !() )
            //              throw new ModelException("Method HacerLogin() postconditions are violated.");

            /*PROTECTED REGION END*/
        }
    }
}
